import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'
import algorithmsLibrary from '@/views/algorithm/alg-market'
import algorithmLogs from '@/views/algorithm/algorithm-logs/index'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }

 * showLocalRoute: true           以本地的路由结构优先,只用于只有一个路由，无嵌套路由
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const allRouters = [
  // 一级菜单列表
  {
    name: 'user',
    path: '/user',
    component: Layout,
    meta: { title: '用户管理', icon: 'user-manage', isShowParent: true },
    children: [{
        name: 'userList',
        path: '/user/userList',
        component: () => import('@/views/user/index'),
        meta: {
          title: '用户列表',
          subTitle: '用于平台用户帐号的创建、删除、修改、查询等管理。'
        }
      },
      {
        name: 'orgList',
        path: '/user/orgList',
        component: () => import('@/views/org/index'),
        meta: { title: '组织列表', subTitle: '用于管理用户群体归属。' }
      }
    ]
  },
  {
    name: 'permission',
    path: '/permission',
    component: Layout,
    meta: { title: '权限管理', icon: 'permissions-manage', isShowParent: true },
    children: [{
      name: 'roleList',
      path: '/permission/roleList',
      component: () => import('@/views/role/index'),
      meta: {
        title: '角色列表',
        subTitle: '为方便分配平台帐号的权限而建立的权限方案管理。'
      }
    },
      {
        name: 'menuList',
        path: '/permission/menuList',
        component: () => import('@/views/menu/index'),
        meta: { title: '菜单管理', subTitle: '用于管理运维中心功能模块的增删改查。' }
      }]
  },
  {
    name: 'ScheduleManager',
    path: '/schedule',
    component: Layout,
    meta: { title: '排班管理', icon: 'scheduling-management' },
    children: [
      {
        name: 'schedule',
        path: '/schedule/schedule-table',
        component: () => import('@/views/schedule/index'),
        meta: { title: '班次设置' }
      },
      {
        name: 'TaskSetting',
        path: '/schedule/task-setting',
        component: () => import('@/views/task-setting/index'),
        meta: { title: '任务管理' }
      },
      {
        name: 'TaskSettingDetail',
        path: '/schedule/task-setting-detail',
        component: () => import('@/views/task-setting/detail'),
        hidden: true,
        meta: { title: '任务详情', activeMenu: '/schedule/task-setting' }
      }
    ]
  },
  {
    name: 'file',
    path: '/file',
    component: Layout,
    meta: { title: '档案管理', icon: 'archives-manage', isShowParent: true },
    children: [{
      name: 'FilePermission',
      path: '/file/permission',
      component: () => import('@/views/personnel/index'),
      meta: {
        title: '人员档案',
        subTitle: '用于记录、查询平台帐号相关的人员档案信息。'
      }
    },{
      name: 'FileCompany',
      path: '/file/company',
      component: () => import('@/views/company/index'),
      meta: {
        title: '企业档案',
        subTitle: '用于记录、查询平台帐号相关的企业档案信息。'
      }
    },
      {
        name: 'FileVehicle',
        path: '/file/vehicle',
        component: () => import('@/views/vehicle-file/index'),
        meta: {
          title: '车辆档案',
          subTitle: '用于记录、查询平台帐号相关的车辆档案信息。'
        }
      },
      {
        name: 'BlacklistManage',
        path: '/file/blacklist-manage',
        component: () => import('@/views/blacklist-manage/index'),
        meta: {
          title: '黑名单管理',
          subTitle: '用于记录、查询黑名单信息。'
        }
      },
      {
        name: 'AssetFile',
        path: '/file/asset-file',
        component: () => import('@/views/asset-file/index'),
        meta: {
          title: '资产档案',
          subTitle: '用于记录、查询资产档案。'
        }
      },
      {
        name: 'AssetType',
        path: '/file/asset-type',
        component: () => import('@/views/asset-type/index'),
        hidden: true,
        meta: {
          title: '资产类型',
          activeMenu: '/file/asset-file'
        }
      }
    ]
  },
  {
    name: 'passing',
    path: '/passing',
    component: Layout,
    meta: { title: '通行管理', icon: 'traffic-management', isShowParent: true },
    children: [
      {
        name: 'passing-logs',
        path: '/passing/passing-logs',
        component: () => import('@/views/passing/passing-logs/index'),
        meta: { title: '人员通行' }
      },
      {
        name: 'car-passing-logs',
        path: '/passing/car-passing-logs',
        component: () => import('@/views/passing/car-passing-logs/index'),
        meta: {
          title: '车辆通行',
        }
      }]
  },
  {
    name: 'algorithm',
    path: '/algorithm',
    component: Layout,
    meta: { title: '算法管理', icon: 'algorithm-manage', isShowParent: true },
    children: [
      {
        name: 'algorithmsLibrary',
        path: '/algorithm/algorithmsLibrary',
        component: algorithmsLibrary,
        meta: { title: '算法库', subTitle: '用于管理平台已接入的算法模型。' }
      },
      {
        name: 'abilityDetail',
        path: '/algorithm/ability-detail',
        component: () => import('@/views/algorithm/alg-market/pages/ability-detail/index'),
        hidden: true,
        meta: {
          title: '算法详情', isHiddenHistoryRoute: true, activeMenu: '/algorithm/algorithmsLibrary'
        }
      },
      {
        // 2021年8月11日14:54:00 韩涛说删除任务统计
        name: 'algTask',
        path: '/algorithm/alg-task',
        hidden: true,
        component: () => import('@/views/algorithm/alg-task/index'),
        meta: { title: '任务统计', subTitle: '' }
      },
      {
        name: 'algTaskDetail',
        path: '/algorithm/alg-task-detail',
        component: () => import('@/views/algorithm/alg-task/detail'),
        hidden: true,
        meta: { title: '任务详情', subTitle: '', isHiddenHistoryRoute: true, activeMenu: '/algorithm/alg-task' }
      },
      {
        name: 'algorithmLogs',
        path: '/algorithm/algorithm-logs',
        component: algorithmLogs,
        meta: { title: '事件统计', subTitle: '' }
      },
      {
        name: 'algorithmLogs',
        path: '/algorithm/alg-event',
        hidden: true,
        component: () => import('@/views/algorithm/event'),
        meta: { title: '事件详情', subTitle: '', isHiddenHistoryRoute: true, activeMenu: '/algorithm/algorithm-logs' }
      },
      {
        name: 'RunOverview',
        path: '/algorithm/run-overview',
        component: () => import('@/views/run-overview/index'),
        meta: { title: '运行总览', subTitle: '用于观看算法的运行总览' }
      },
    ]
  },
  {
    name: 'device',
    path: '/device',
    component: Layout,
    meta: { title: '设备管理', icon: 'equipment-manage', isShowParent: true },
    children: [
      {
        name: 'DeployDevice',
        path: '/device/deploy-device',
        component: () => import('@/views/device/deploy-device/index'),
        meta: { title: '设备接入', subTitle: '帮助用户实现设备组网，对设备进行统一管理和连接控制。' }
      },
      {
        name: 'ThingModelLibrary',
        path: '/device/thingmodel-library',
        component: () => import('@/views/device/thing-model/index'),
        meta: { title: '物模型库', subTitle: '用于存储物联网通信所需的物模型，对物模型的属性和服务进行定义，是产品构建的基础。' }
      },
      {
        name: 'CreateProduct',
        path: '/device/create-product',
        component: () => import('@/views/device/create-product/index'),
        meta: { title: '产品构建', subTitle: '帮助用户实现设备组网，产品构建将抽象的物模型概念具象化，是设备接入的基础。' }
      },
      {
        hidden: true,
        name: 'ThingModelDetail',
        path: '/device/thingmodel-detail',
        component: () => import('@/views/device/thingModel-detail/index'),
        meta: {
          title: '物模型详情',
          subTitle: '物模型1',
          isHiddenHistoryRoute: true,
          navBack: true,
          activeMenu: '/device/thingmodel-library'
        }
      },
      {
        name: 'DeployDeviceDetail',
        path: '/device/deploy-device-detail',
        hidden: true,
        component: () => import('@/views/device/deploy-device/detail'),
        meta: { activeMenu:'/device/deploy-device',title: '设备详情', navBack: true, isHiddenHistoryRoute: true }
      },
      {
        name: 'product-detail',
        path: '/device/product-detail',
        hidden: true,
        meta: {
          hidden: true,
          title: '产品查看',
          isHiddenHistoryRoute: true,
          navBack: true,
          activeMenu: '/device/create-product'
        },
        component: () => import('@/views/device/create-product/detail')
      },
      {
        name: 'DeviceGroup',
        path: '/device/device-group',
        meta: { title: '设备分组', subTitle: '帮助用户进行跨产品级设备管理。' },
        component: () => import('@/views/device/group/index')
      },
      {
        name: 'DeviceGroupDetail',
        path: '/device/device-group-detail',
        hidden: true,
        meta: { title: '分组详情', isHiddenHistoryRoute: true, navBack: true, activeMenu: '/device/device-group' },
        component: () => import('@/views/device/group/detail')
      },
      {
        name: 'Gateway',
        path: '/device/gateway',
        meta: {
          title: '网关设置',
          subTitle: '帮助用户集中管理多种设备的联网方式。。'
        },
        component: () => import('@/views/device/gateway/index')
      },
      {
        name: 'GatewayDetail',
        path: '/device/gateway-detail',
        hidden: true,
        meta: { title: '网关详情', isHiddenHistoryRoute: true, navBack: true, activeMenu: '/device/gateway' },
        component: () => import('@/views/device/gateway/detail')
      }
    ]
  },
  {
    name: 'AlarmScheme',
    path: '/alarm-scheme',
    component: Layout,
    meta: { icon: 'alarm-manage' },
    children: [
      {
        path: '',
        meta: { title: '告警管理', subTitle: '集中管理设备的告警方案和告警记录。' },
        component: () => import('@/views/alarm-scheme/index')
      }
    ]
  },
  {
    name: 'PreviewPlayer',
    path: '/preview-admin',
    component: Layout,
    meta: { title: '预览管理', icon: 'preview-management', subTitle: '用于管理平台预览模型。' },
    children: [
      {
        path: '/preview-admin/panoramic-map',
        name: 'PublicComponents',
        component: () => import('@/views/preview-player/index.vue'),
        meta: { title: '全景地图', subTitle: '用于管理平台的全景地图。', isNoneShowTag: true }
      }, {
        path: '/preview-admin/map',
        name: 'Map',
        component: () => import('@/views/map-demo/index.vue'),
        meta: { title: '地图组件', subTitle: '用于管理平台的地图组件。', isNoneShowTag: true }
      }
    ]
  },
  // {
  //   name: 'ExternalServices',
  //   path: '/external-services',
  //   component: Layout,
  //   meta: { title: '外部服务', icon: 'table', subTitle: '用于管理平台的外部服务' },
  //   children: [
  //     {
  //       path: '/external-services/property-admin',
  //       name: 'PropertyAdmin',
  //       component: () => import('@/views/property-admin/index.vue'),
  //       meta: { title: '物业管理', subTitle: '定义物业管理支出的个性化方案。' }
  //     },
  //     {
  //       path: '/external-services/energy-consumption',
  //       name: 'EnergyConsumption',
  //       component: () => import('@/views/energy-consumption/index.vue'),
  //       meta: { title: '能源消耗', subTitle: '定义能源消耗支出的个性化方案。' }
  //     }
  //   ]
  // },
  // 产业分析部分
  {
    path: '/maintain',
    component: Layout,
    name: 'maintain',
    meta: { title: '产业分析运维中心', icon: 'industry-analysis' },
    children: [
      // {
      //   path: '/maintain/news',
      //   name: 'news',
      //   component: () => import('@/child-business/views/maintain/news/news'),
      //   meta: { title: '资讯管理' }
      // },
      {
        path: '/maintain/policy',
        name: 'policy',
        component: () => import('@/child-business/views/maintain/news/policy'),
        meta: { title: '政策管理', icon: 'el-icon-s-order' }
      },
      { // 政府专有
        path: '/maintain/parkList',
        name: 'parkList',
        component: () => import('@/child-business/views/maintain/organize/parkList'),
        meta: { title: '园区管理', icon: 'el-icon-s-order' }
      },

      {
        path: '/maintain/company',
        name: 'company',
        component: () => import('@/child-business/views/maintain/company/company'),
        meta: { title: '我的企业', icon: 'el-icon-s-home' }
      },
      {
        path: '/maintain/operationLog',
        name: 'operationLog',
        component: () => import('@/child-business/views/maintain/operationLog/index'),
        meta: { title: '操作日志', icon: 'el-icon-date' }
      },
      {
        path: '/maintain/updatecompany',
        name: 'updatecompany',
        component: () => import('@/child-business/views/maintain/company/updateCom'),
        hidden: true,
        meta: { title: '修改企业信息' }
      },
      {
        path: '/maintain/AnnualReport',
        name: 'AnnualReport',
        component: () => import('@/child-business/views/maintain/company/AnnualReport'),
        hidden: true,
        meta: { title: '修改/新增年度报告' }
      },
      {
        path: '/maintain/message',
        name: 'Message',
        component: () => import('@/child-business/views/maintain/message/index'),
        meta: { title: '消息通知', icon: 'el-icon-chat-line-round' }
      },
      {
        path: '/maintain/addMessage',
        name: 'addMessage',
        component: () => import('@/child-business/views/maintain/message/addMessage'),
        meta: { title: '添加消息', subTitle: '添加消息' },
        hidden: true
      },
      {
        path: '/maintain/upMessage',
        name: 'upMessage',
        component: () => import('@/child-business/views/maintain/message/upMessage'),
        hidden: true,
        meta: { title: '修改消息' }
      },
      {
        path: '/maintain/ParkInformation',
        name: 'ParkInformation',
        component: () => import('@/child-business/views/maintain/ParkInformation/index'),
        meta: { title: '园区信息', icon: 'el-icon-s-flag' }
      },
      {
        path: '/maintain/Merchants',
        name: 'Merchants',
        component: () => import('@/child-business/views/maintain/Merchants/index'),
        meta: { title: '招商管理', icon: 'el-icon-tickets' }
      },
      {
        path: '/maintain/business',
        name: 'business',
        component: () => import('@/child-business/views/maintain/business/index'),
        meta: { title: '企业管理', icon: 'table' }
      },
      {
        path: '/maintain/productStock',
        name: 'productStock',
        component: () => import('@/child-business/views/maintain/productManage/productStock'),
        meta: { title: '商品库存', icon: 'table' }
      },
      {
        path: '/maintain/productType',
        name: 'productType',
        component: () => import('@/child-business/views/maintain/productManage/productType'),
        meta: { title: '产品类型', icon: 'table' }
      }
    ]
  },
  {
    path: '/operating-expenses',
    component: Layout,
    name: 'maintain',
    meta: { title: '运营支出', icon: 'operating-expenses' },
    children: [
      {
        path: '/operating-expenses/property-admin',
        name: 'PropertyAdmin',
        component: () => import('@/views/property-admin/index.vue'),
        meta: { title: '物业管理', subTitle: '定义物业管理支出的个性化方案。' }
        // operating- expenses
      },
      {
        path: '/operating-expenses/energy-consumption',
        name: 'EnergyConsumption',
        component: () => import('@/views/energy-consumption/index.vue'),
        meta: { title: '能源消耗', subTitle: '定义能源消耗支出的个性化方案。' }
      },
    ]
  },

  // 智慧园区
  {
    path: '/smartParkFront',
    component: Layout,
    name: 'smartParkFront',
    meta: {
      title: '智慧园区运维中心',
      icon: 'table'
    },
    children: [
      // {
      //   path: 'messageNotify',
      //   name: 'messageNotify',
      //   component: () => import('@/views/smartParkFront/messageNotify/index'),
      //   meta: { title: '消息通知', icon: 'table' }
      // },
      // {
      //   path: 'addMessage',
      //   name: 'addMessage',
      //   component: () => import('@/views/smartParkFront/messageNotify/addMessage'),
      //   hidden: true,
      //   meta: {
      //     title: '消息通知',
      //     icon: 'table'
      //   }
      // },
      // {
      //   path: 'upMessage',
      //   name: 'upMessage',
      //   component: () => import('@/views/smartParkFront/messageNotify/upMessage'),
      //   hidden: true,
      //   meta: {
      //     title: '消息通知',
      //     icon: 'el-icon-date'
      //   }
      // },
      {
        path: '/smartParkFront/assetType',
        name: 'assetType',
        component: () => import('@/views/smartParkFront/assetType/index'),
        meta: {
          title: '资产类型'

        }
      },
      {
        path: '/smartParkFront/productType',
        name: 'productType',
        component: () => import('@/views/smartParkFront/productType/index'),
        meta: {
          title: '产品类型'

        }
      },
      {
        path: '/smartParkFront/activityLog',
        name: 'activityLog',
        component: () => import('@/views/smartParkFront/activityLog/index'),
        meta: {
          title: '操作日志'

        }
      },
      {
        path: '/smartParkFront/vehicleFiles',
        name: 'vehicleFiles',
        component: () => import('@/views/smartParkFront/vehicleFiles/index'),
        meta: {
          title: '车辆档案'

        }
      }
    ]
  },
  // 工业视觉
  {
    path: '/IndustryBackstage',
    component: Layout,
    name: 'IndustryBackstage',
    meta: { title: '工业视觉', icon: 'industrial-visual'},
    children: [
      {
        path: '/IndustryBackstage/workshopfile',
        name: 'workshopfile',
        component: () => import('@/child-business/views/IndustrialVision/workshopfile/workshopfile'),
        meta: { title: '车间档案' }
      },
      {
        path: '/IndustryBackstage/workshopmap',
        name: 'workshopmap',
        component: () => import('@/child-business/views/IndustrialVision/workshopmap/workshopmap'),
        meta: { title: '车间地图管理' }
      },
      {
        path: '/IndustryBackstage/prolinemanage',
        name: 'prolinemanage',
        component: () => import('@/child-business/views/IndustrialVision/prolinemanage/prolinemanage'),
        meta: { title: '产线管理' }
      },
      {
        path: '/IndustryBackstage/producttype',
        name: 'producttype',
        component: () => import('@/child-business/views/IndustrialVision/producttype/producttype'),
        meta: { title: '产品类型' }
      },
      {
        path: '/IndustryBackstage/equipmentmanage',
        name: 'producttype',
        component: () => import('@/child-business/views/IndustrialVision/equipmentmanage/equipmentmanage'),
        meta: { title: '设备管理' }
      },
      {
        path: '/IndustryBackstage/productmanage',
        name: 'producttype',
        component: () => import('@/child-business/views/IndustrialVision/productmanage/productmanage'),
        meta: { title: '产品管理' }
      },
      {
        path: '/IndustryBackstage/prolineset',
        name: 'prolineset',
        component: () => import('@/child-business/views/IndustrialVision/prolineset/prolineset'),
        meta: { title: '产线配置' }
      },
      {
        path: '/IndustryBackstage/prolinesetpage',
        name: 'prolinesetpage',
        component: () => import('@/child-business/views/IndustrialVision/prolineset/prolinesetpage'),
        meta: { title: '产线配置页面' },
        hidden: true
      },
      {
        path: '/IndustryBackstage/consumerelation',
        name: 'consumerelation',
        component: () => import('@/child-business/views/IndustrialVision/consume/consumerelation'),
        meta: { title: '能耗关联' }
      },
      {
        path: '/IndustryBackstage/consumetype',
        name: 'consumetype',
        component: () => import('@/child-business/views/IndustrialVision/consume/consumetype'),
        meta: { title: '能耗类型' },
      }
    ]
  },
  // 运维中心
  {
    path: '/DevopsCenter',
    component: Layout,
    name: 'DevopsCenter',
    meta: { title: '运维中心', icon: 'operations-center'},
    children: [
      {
        path: '/DevopsCenter/algorithm',
        name: 'algorithm',
        component: () => import('@/child-business/views/DevopsCenter/algorithm/algorithm'),
        meta: { title: '算法管理' }
      },
      {
        path: '/DevopsCenter/mapManage',
        name: 'mapManage',
        component: () => import('@/child-business/views/DevopsCenter/mapManage/mapManage'),
        meta: { title: '地图管理' }
      },
      {
        path: '/DevopsCenter/equipmentType',
        name: 'mapManage',
        component: () => import('@/child-business/views/DevopsCenter/equipmentType/equipmentType'),
        meta: { title: '设备类型' }
      },
    ]
  },
  {
    path: '/scene', component: Layout,
    meta: { title: '应用场景', icon: 'app-scenarios-icon', subTitle: '用于管理平台内已生成场景的不同版本。' },
    showLocalRoute: true,
    children: [
      {
        path: '/scene/list',
        name: 'SceneList',
        component: () => import('@/views/scene/index'),
        meta: { title: '应用场景', subTitle: '用于管理平台内已生成场景的不同版本。' }
      }
    ]
  },

  {
    path: '/monitor',
    component: Layout,
    meta: { title: '安防监控', icon: 'map-configuration' },
    children: [
      {
        path: '/monitor/global-monitor',
        name: 'GlobalMonitor',
        component: () => import('@/views/monitor/global/index'),
        meta: { title: '全局监控' }
      },
      {
        path: '/monitor/regional-management',
        name: 'RegionalManagement',
        component: () => import('@/views/regional-management/index'),
        meta: { title: '区域管理', subTitle: '用于管理各区域' }
      }
    ]
  }

  // {
  //   name: 'File',
  //   path: '/file',
  //   redirect: '/file/personnel',
  //   component: Layout,
  //   meta: { title: '档案管理', icon: 'table' }
  // },
  // {
  //   name: 'PersonnelList',
  //   path: '/file/personnel',
  //   component: () => import('@/views/personnel/index'),
  //   meta: { title: '人员管理', subTitle: '用于记录、查询平台帐号相关的人员档案信息。' }
  // },
  // {
  //   name: 'VehicleList',
  //   path: '/file/vehicle',
  //   component: () => import('@/views/vehicle/index'),
  //   meta: { title: '车辆管理', subTitle: '用于记录、查询平台帐号相关的车辆档案信息。' }
  // }
]

export const constantRoutes = [
  // {
  //   path: '/login',
  //   component: () => import('@/views/login/index'),
  //   hidden: true
  // },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  }

  // {
  //   path: '/',
  //   component: Layout,
  //   redirect: '/scene/list',
  //   meta: { title: '首页', icon: 'dashboard' },
  //   children: [{
  //     path: 'dashboard',
  //     name: 'Dashboard',
  //     component: () => import('@/views/dashboard/index'),
  //     meta: { title: 'Dashboard', icon: 'dashboard' }
  //   }]
  // },
  // TODO 开发暂时不需要动态加载
  // {
  //   path: '/file',
  //   component: Layout,
  //   meta: { title: '档案管理', icon: 'dashboard' },
  //   children: [{
  //     path: '/file/personnel',
  //     name: 'FilePersonnel',
  //     component: () => import('@/views/personnel/index'),
  //     meta: { title: '人员档案', subTitle: '用于记录、查询平台帐号相关的人员档案信息。' }
  //   }, {
  //     path: '/file/vehicle',
  //     name: 'FileVehicle',
  //     component: () => import('@/views/vehicle-file/index'),
  //     meta: { title: '车辆档案', subTitle: '用于记录、查询平台帐号相关的车辆档案信息。' }
  //   }]
  // }
  // {
  //   path: '/test-component',
  //   component: Layout,
  //   meta: { title: 'test', icon: ' el-icon-s-tools' },
  //   children: [
  //     {
  //       path: '/test-component/list',
  //       name: 'PublicComponents',
  //       component: () => import('szlschiefdata/views/test-public-components/index.vue'),
  //       meta: { title: '组件库', subTitle: '用于演示和体验公共组件' }
  //     }
  //   ]
  // }

  // {
  //   path: '/camera',
  //   component: Layout,
  //   meta: { title: '摄像头', icon: ' el-icon-s-tools' },
  //   children: [{
  //     path: '',
  //     name: 'CameraPlayer',
  //     component: () => import('@/views/camera-player/index'),
  //     meta: { title: '摄像头管理', subTitle: '用于展示摄像头播放器' }
  //   }]
  // }
  // 404 page must be placed at the end !!!
  // { path: '*', redirect: '/404', hidden: true }
]

export const defaultConstRoutesLength = constantRoutes.length

const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
  })

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
